package org.hot100_2;

public class leetcode206 {
    public ListNode reverseList(ListNode head){
        if (head==null){
            return head;
        }

        ListNode pre = null;
        ListNode cur = head;
        ListNode next = null;

        while (cur!=null){
            next=cur.next;
            cur.next=pre;
            pre=cur;
            cur=next;
        }

        return pre;
    }
}
